<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<include file="Public:meta" />
</head>
<body id="main_page">
<include file="Public:position" />
<div class="container">
    <form enctype="multipart/form-data" method="post" id="frm">
      <input type="hidden" name="NowPage" id="NowPage" value="{$NowPage}" />
      <div class="table">
       <div class="toolbars">
            <li class="toolbar"><a id="btnBack" href="{$Group}/channel/index" target="_self" title="返回">返回</a></li>
            <li class="toolbar"><a id="btnSaveAll" href="{$Url}Add"  title="添加属性标记" target="_self">添加属性标记</a></li>
            <li class="toolbar"><a id="selectall" onclick="CheckAll()"  title="全选">全选</a></li>
            <li class="toolbar"><a id="del" onclick="BatchDel()" title="批量删除">删除</a></li>
            <li class="toolbar"><a id="sortall" onclick="BatchSort()" title="批量排序">排序</a></li>
        </div>                
        <table class="datatable" id="datatable">
            <tr>
                <th width="40px"  nowrap="nowrap">选中</th>
                <th width="70px" >属性标记ID</th>
                <th width="200px" >属性标记名称</th> 
                <th width="95px" >属性标记排序</th>
                <th width="110px" >所属频道模型</th>
                <th width="90px" >属性</th>
                <th style="text-align:left;padding-left:20px">操作</th>
            </tr>  
            <volist name="Label" id="lbl">
            <tr id="tr{$lbl.LabelID}">
            <td><input class="checkrow" type="checkbox" name="LabelID[]" value="{$lbl.LabelID}" /></td>
            <td>{$lbl.LabelID}</td>
            <td>{$lbl.LabelName}</td>
            <td><input type="text" class='textinput' onclick="this.select()" style="width:65px" name="LabelOrder[]" value="{$lbl.LabelOrder}" />
            	<input type="hidden" class='textinput' name="LabelOrderID[]" value="{$lbl.LabelID}" />
            </td>
            <td><b style="color:{$lbl.ChannelModelID|ChannelModelColor}">{$lbl.ChannelModelName}</b></td>
            <td>
                <eq name="lbl.IsSystem" value="1"><span style="color:red">系统</span>
                <else/>
                <span style="color:black">自定义</span>
                </eq>
                &nbsp;
                <eq name="lbl.IsEnable" value="1"><span style="color:black">启用</span>
                <else/><span style="color:red">禁用</span></eq>
            </td>
            <td class="operator">
            	<a style="float:left" href="{$Url}Modify/LabelID/{$lbl.LabelID}" id="btnEdit">修改</a>
                <div class="btn-sep"></div>
                <eq name="lbl.IsSystem" value="0">
                    <a style="float:left" onclick="Del({$lbl.LabelID})" class="btnDel">删除</a>
                </eq>
            </td>
            </tr>
            </volist>                                
        </table>
		<div class="tfoot">
        	<div class="page"><span class="pagesize">每页<span class="pz">{$AdminPageSize}</span>条</span>{$Page}</div>
        </div>
    </div>
  </form>
</div>
</body>
</html>
<script type="text/javascript">
function Del(id){
	$.confirm("{$Think.lang.DeleteTip}", function () {
		url = "{$Url}del/LabelID/"+id+"/p/{$NowPage}";
		location.href = url;
	}, function () {
		return true;
	});
}
//回调函数
function DelComplete(data, textStatus){
	if (data.status == 1){
		$(data.data).css("display","none");
	}else{ 
		//删除失败
		ErrorBox(data.info);
	}
}

//批量删除
function BatchDel(){
	//var arrChk = $("input[name='InfoID[]'][checked]"); //在高速浏览器长度总是返回0
	var arrChk = $("input[name='LabelID[]']");
	var n = 0;
	for(var i = 0; i < arrChk.length; i++){
		if(arrChk[i].checked) n++;
	}
	
	if( n == 0 ) {
		WarnBox("{$Think.lang.CheckDeleteTip}");
		return;
	}
	
	$.confirm("{$Think.lang.DeleteTip}", function () {
		$('#frm').attr("action", "{$Url}batchDel");
		$('#frm').submit();
	}, function () {
		return true;
	});
}

//排序
function BatchSort(){
	$.confirm("{$Think.lang.SortTip}", function () {
		$('#frm').attr("action", "{$Url}batchSort");
		$('#frm').submit();
	}, function () {
		return true;
	});
}	
</script>